package alp.starcode.nudtportal.framework.mybatis.entity;

import alp.starcode.nudtportal.framework.constant.ElasticConst;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * <p>
 * log_user_action(小程序用户操作日志)
 * </p>
 *
 * @author xwx
 * @since 2023-08-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("log_user_action")
@ApiModel(value = "LogUserAction对象", description = "log_user_action(小程序用户操作日志)")
@Document(indexName = ElasticConst.ES_INDEX_LOG_USER_ACTION)
public class LogUserAction extends Model<LogUserAction> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "行为流水号")
    @TableId("action_id")
    @Field(type = FieldType.Keyword)
    private String actionId;

    @ApiModelProperty(value = "用户流水号")
    @TableField("user_id")
    @Field(type = FieldType.Keyword)
    private String userId;

    @ApiModelProperty(value = "登录账号")
    @TableField("login_name")
    @Field(type = FieldType.Text)
    private String loginName;

    @ApiModelProperty(value = "一卡通卡号")
    @TableField("campus_number")
    @Field(type = FieldType.Text)
    private String campusNumber;

    @ApiModelProperty(value = "操作类型")
    @TableField("access_type")
    @Field(type = FieldType.Integer)
    private Integer accessType;

    @ApiModelProperty(value = "操作名称")
    @TableField("business_name")
    @Field(type = FieldType.Text, analyzer = ElasticConst.ES_IK_MAX_WORD)
    private String businessName;

    @ApiModelProperty(value = "操作内容")
    @TableField("access_content")
    @Field(type = FieldType.Text)
    private String accessContent;

    @ApiModelProperty(value = "ip地址")
    @TableField("ip_address")
    @Field(type = FieldType.Text)
    private String ipAddress;

    @ApiModelProperty(value = "服务器ip地址")
    @TableField("server_ip_address")
    @Field(type = FieldType.Text)
    private String serverIpAddress;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    @Field(type = FieldType.Long)
    private Long createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    @Field(type = FieldType.Long)
    private Long updateTime;


    @Override
    protected Serializable pkVal() {
        return this.actionId;
    }

}
